#ifndef __SURFACE_H__
#define __SURFACE_H__

#include "SDLHeaders.h"

class Surface
{
public:

	SDL_Surface* operator()() {
		return _surface;
	}

	Surface(SDL_Surface* surface = NULL) 
		: _surface(surface),
		  _is_owner(false) {
		if(!surface) {
			if(createSurface()) {
				_is_owner = true;
			}
		}
	};

	virtual ~Surface(void) {
		if(_is_owner) delete _surface;
	}

private:
	SDL_Surface* _surface;
	bool		 _is_owner;
	bool createSurface() {return true;};
};

#endif